package com.hoshiicloud.mallshop.feign.hystrix;

import com.hoshiicloud.common.query.OmnipotentParam;
import com.hoshiicloud.common.query.OmnipotentWrapper;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.goods.entity.goods.GoodsGallery;
import com.hoshiicloud.goods.entity.spu.ExtSpuTags;
import com.hoshiicloud.goods.entity.spu.SpuSalesCategory;
import com.hoshiicloud.goods.param.goods.GoodsGalleryQueryParam;
import com.hoshiicloud.goods.param.spu.SpuSalesCategoryAddParam;
import com.hoshiicloud.goods.param.spu.SpuSalesCategoryQueryParam;
import com.hoshiicloud.mallshop.feign.ShopGoods2FeignService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class ShopGoods2FeignServiceFallback implements FallbackFactory<ShopGoods2FeignService> {
    @Override
    @HystrixCommand
    public ShopGoods2FeignService create(Throwable throwable) {
        log.error("shop聚合调用goods失败"+throwable.toString());
        return new ShopGoods2FeignService(){


            @Override
            public Response<List<SpuSalesCategory>> listSpuSalesCategoryBySpuIds(List<Long> spuIds) {
                return Response.failed("根据扩展spuid获取营销类目信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveSpuSalesCategoryBatch(List<SpuSalesCategory> allSpuSalesCategory) {
                return Response.failed("根据新增营销类目信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<SpuSalesCategory>> getSalesCategoryByParam(SpuSalesCategoryQueryParam param) {
                return Response.failed("任意条件查询营销类目信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> spuSalesCategoryAdd(SpuSalesCategoryAddParam param) {
                return Response.failed("新增商品营销类目信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> delSalesCategory(Long id) {
                return Response.failed("删除商品营销类目信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateSpuSalesCategoryBatch(OmnipotentParam<SpuSalesCategory> param) {
                return Response.failed("批量更新商品图片资源表信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<ExtSpuTags>> listExtSpuTagsBySpuIds(List<Long> spuIds) {
                return Response.failed("根据扩展spuid获取标签信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveExtSpuTagsBatch(List<ExtSpuTags> allExtSpuTags) {
                return Response.failed("批量新增商品标签信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<ExtSpuTags>> getExtSpuTagsBySpuId(Long spuId) {
                return Response.failed("根据拓展spuId查询商品标签信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> deleteTagBatch(Long extSpuId) {
                return Response.failed("批量删除商品标签信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateExtSpuTagsBatch(OmnipotentParam<ExtSpuTags> param) {
                return Response.failed("批量更新ExtSpuTags失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> removeExtSpuTagsBatch(List<OmnipotentWrapper> param) {
                return Response.failed("批量删除ExtSpuTags： 物理删除 失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<GoodsGallery>> listGoodsGalleryBySpuIds(List<Long> spuIds) {
                return Response.failed("根据extSpuId的集合 查询相册关联表信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveGoodsGalleryBatch(List<GoodsGallery> allGoodsGallery) {
                return Response.failed("批量新增商品关联图片信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<GoodsGallery>> queryGoodsGallery(GoodsGalleryQueryParam param) {
                return Response.failed("任意条件查询商品关联图片信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> deleteGalleryByExtSpuId(Long extSpuId) {
                return Response.failed("批量删除相册关联信息表失败"+ throwable.getMessage());

            }

            @Override
            public Response<Boolean> updateGoodsGalleyBatch(OmnipotentParam<GoodsGallery> param) {
                return Response.failed("批量更新商品图片资源失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> removeGoodsGalleryBatch(List<OmnipotentWrapper> param) {
                return Response.failed("批量删除GoodsGallery: 物理删除 失败"+ throwable.getMessage());
            }
        };
    }
}
